GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GtkFilterListModel, gtk_filter_list_model, GTK, FILTER_LIST_MODEL, GObject)
+/**
+ * GtkFilterListModelFilterFunc:
+ * @item: (type GObject): The item that may be filtered
+ * @user_data: user data
+ *
+ * User function that is called to determine if the @item of the original model should be visible.
+ * If it should be visible, this function must return %TRUE. If the model should filter out the
+ * @item, %FALSE must be returned.
+ *
+ * Returns: %TRUE to keep the item around
+ */
typedef gboolean (* GtkFilterListModelFilterFunc) (gpointer item, gpointer user_data);
GDK_AVAILABLE_IN_ALL
}
node->item = self->map_func (g_list_model_get_item (self->model, position), self->user_data);
+ if (!G_TYPE_CHECK_INSTANCE_TYPE (node->item, self->item_type))
+ {
+ g_critical ("Map function returned a %s, but it is not a subtype of the model's type %s",
+ G_OBJECT_TYPE_NAME (node->item), g_type_name (self->item_type));
+ }
g_object_add_weak_pointer (node->item, &node->item);
return node->item;
/**
* GtkMapListModelMapFunc:
- * @item: (transfer full): The item to map
+ * @item: (type GObject) (transfer full): The item to map
* @user_data: user data
*
- * User function that is called to map an @item of the original model.
+ * User function that is called to map an @item of the original model to
+ * an item expected by the map model.
*
- * Returns: (transfer full): The item to map to. This function may not return %NULL
+ * The returned items must conform to the item type of the model they are
+ * used with.
+ *
+ * Returns: (type GObject) (transfer full): The item to map to.
+ * This function may not return %NULL
*/
typedef gpointer (* GtkMapListModelMapFunc) (gpointer item, gpointer user_data);
/**
* GtkTreeListModelCreateModelFunc:
- * @item: The item that is expaned
+ * @item: (type GObject): The item that is being expanded
* @user_data: User data passed when registering the function
*
* Prototype of the function called to create new child models when
* gtk_tree_list_row_set_expanded() is called.
+ *
+ * This function can return %NULL to indicate that @item is guaranteed to be
+ * a leave node and will never have children.
+ * If it does not have children but may get children later, it should return
+ * an empty model that is filled once children arrive.
+ *
+ * Returns: (nullable): The model tracking the children of @item or %NULL if
+ * @item can never have children
*/
typedef GListModel * (* GtkTreeListModelCreateModelFunc) (gpointer item, gpointer user_data);